$(document).ready(function() {
    // create the loading window and set autoOpen to false
    $("<div id='waitingdlg'></div>").dialog({
        autoOpen: false,	// set this to false so we can manually open it
        dialogClass: "loadingScreenWindow",
        closeOnEscape: false,
        draggable: false,
        width: 460,
        minHeight: 50,
        modal: true,
        buttons: {},
        resizable: false,
        open: function() {
            // scrollbar fix for IE
            $('body').css('overflow','hidden');
        },
        close: function() {
            // reset overflow
            $('body').css('overflow','auto');
        }
    }); // end of dialog
});
function waitingDialog(waiting) { // I choose to allow my loading screen dialog to be customizable, you don't have to
    $("#waitingdlg").html(waiting.message && '' != waiting.message ? waiting.message : '<img src="images/loading-s.gif"/>Please wait...');
    $("#waitingdlg").parent().find('a.ui-dialog-titlebar-close').remove();
    $("#waitingdlg").dialog('option', 'title', waiting.title && '' != waiting.title ? waiting.title : 'Loading');
    $("#waitingdlg").dialog('option', 'closeOnEscape', false);
    $("#waitingdlg").dialog('open');
}
function closeWaitingDialog() {
    $("#waitingdlg").dialog('close');
}
